<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 
    大厂面试题分享：如何让(a===1&&a===2&&a===3)的值为true?
    比如我们有一个对象，在不重写toString()方法和valueOf()方法的情况下，
    在 Node 或者浏览器输出的结果是这样的
  class Person {
    constructor() {
      this.name = name;
      }
    }

  const best = new Person("Kobe");
  console.log(best); // log: Person {name: "Kobe"}
  console.log(best.toString()); // log: [object Object]
  console.log(best.valueOf()); // log: Person {name: "Kobe"}
  console.log(best + "GiGi"); // log: [object Object]GiGi

  class Person {
  constructor(name) {
    this.name = name;
  }
  // 复写 valueOf 方法
  valueOf() {
    return this.name;
  }
}
   -->
    <script>
    </script>
  </body>
</html>
